package com.grad.webstudy.vo;

import com.grad.webstudy.model.Authority;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 权限的显示对象
 * @Author: zjf
 * @Date: 2020/2/2 15:03.
 */
public class AuthVo {


    private Integer id;

    private String auth;

    private Integer parentId;

    private String authDesc;

    private boolean hasChild;//是否有子权限

    private List<AuthVo> children;//子权限列表


    @Override
    public String toString() {
        return "AuthVo{" +
                "id=" + id +
                ", auth='" + auth + '\'' +
                ", parentId=" + parentId +
                ", authDesc='" + authDesc + '\'' +
                ", hasChild=" + hasChild +
                ", children=" + children +
                '}';
    }

    public AuthVo(Builder builder) {
        this.id = builder.id;
        this.auth = builder.auth;
        this.parentId = builder.parentId;
        this.authDesc = builder.authDesc;
        this.hasChild = builder.hasChild;
        this.children = builder.children;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getAuth() {
        return auth;
    }

    public void setAuth(String auth) {
        this.auth = auth;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public String getAuthDesc() {
        return authDesc;
    }

    public void setAuthDesc(String authDesc) {
        this.authDesc = authDesc;
    }

    public boolean isHasChild() {
        return hasChild;
    }

    public void setHasChild(boolean hasChild) {
        this.hasChild = hasChild;
    }

    public List<AuthVo> getChildren() {
        return children;
    }

    public void setChildren(List<AuthVo> children) {
        this.children = children;
    }

    public static class Builder{

        private Integer id;

        private String auth;

        private Integer parentId;

        private String authDesc;

        private boolean hasChild;//是否有子权限

        private List<AuthVo> children;//子权限列表

        public Builder setId(Integer id) {
            this.id = id;
            return this;
        }

        public Builder setAuth(String auth) {
            this.auth = auth;
            return this;
        }

        public Builder setParentId(Integer parentId) {
            this.parentId = parentId;
            return this;
        }

        public Builder setAuthDesc(String authDesc) {
            this.authDesc = authDesc;
            return this;
        }

        public Builder setHasChild(boolean hasChild) {
            this.hasChild = hasChild;
            return this;
        }

        public Builder setChildren(List<AuthVo> children) {
            this.children = children;
            return this;
        }

        public AuthVo build(){
            return new AuthVo(this);
        }
    }

}
